package Reflect;

import java.lang.reflect.Field;

/**
 * 反射学习
 * Created by svenl on 7/12/2017.
 */
public class Main {

    public static ToDoItem toDoItem;

    public static void main(String[] args) throws ClassNotFoundException {


        toDoItem = new ToDoItem();

        for (Field field : toDoItem.getClass().getDeclaredFields()) {

            ToDo toDo = field.getAnnotation(ToDo.class);
            if(  toDo != null ){
                System.out.println(" Found annotation for fields "+ field );
                System.out.println( "author : " + toDo.author());
                System.out.println(  "priority :  "+toDo.priority());
                System.out.println(  "status : " +toDo.status());

            }
        }


    }
}
